Skip to content

addon-unit: dotted-path invocation + scheduled runs - #3

Merged
eduralph merged 4 commits into
mainfrom
ci/addon-unit-dotted-path
Apr 20, 2026
Merged

addon-unit: dotted-path invocation + scheduled runs#3
eduralph merged 4 commits into
mainfrom
ci/addon-unit-dotted-path

Conversation

@eduralph

Copy link
Copy Markdown
Collaborator

Summary

  • Runner (scripts/ubuntu/run-addon-unit.sh) and testbed CI (.github/workflows/addon-unit-tests.yml) now load each addon test via its dotted path (<Addon>.tests.<module>) from addons-source/, matching addons-source/.github/workflows/ci.yml. Catches namespace-package traps that discover-from-tests/ hides (PR #824 / bug 0012691).
  • addon-unit-tests.yml gains push/PR/nightly (06:30 UTC) triggers + continue-on-error job-level, so regressions surface in the testbed without blocking merges (matches unit-tests.yml gate policy).
  • CLAUDE.md documents the pre-push ./scripts/ubuntu/run-addon-unit.sh <Addon> convention and the reason it catches namespace-package bugs.

Test plan

  • ./scripts/ubuntu/run-addon-unit.sh DataEntryGramplet passes against the fixed PR #824 branch (6/6 tests).
  • ./scripts/ubuntu/run-addon-unit.sh TMGimporter still runs 157 tests (pre-existing integration error unchanged).
  • WebSearch's from models import … failure under hardened runner matches its failure under the previous discover invocation — no regression introduced.
  • GitHub: workflow fires on this PR and on nightly cron.

The prior runner ran ``xmlrunner discover`` from inside each addon's
tests/ dir. That invocation hides Python namespace-package traps: the
addon directory never enters sys.modules as a package, so
``from <Addon> import <Addon>`` in a test body resolves to the class
rather than the same-named submodule. When a contributor (or
addons-source's own ci.yml) runs the tests by dotted path, the trap
surfaces as AttributeError on a class attribute — exactly the
bug 0012691 failure Gary hit on PR #824.

Changes:
- scripts/ubuntu/run-addon-unit.sh: collect
  ``<Addon>.tests.<module>`` paths per addon and invoke
  ``python -m xmlrunner <mods>`` from addons-source/, matching the
  upstream ci.yml shape.
- .github/workflows/addon-unit-tests.yml: add push/PR/schedule
  (06:30 UTC, slotted after docker-build's 06:00), switch to the same
  dotted-path invocation, and mark the job continue-on-error in line
  with unit-tests.yml.
- CLAUDE.md: document the pre-push ``run-addon-unit.sh <Addon>``
  convention, explain why dotted-path loading catches namespace-package
  bugs, and refresh Status + cron list.
TMGimporter/libtmg.py imports the dbf PyPI package under a try/except
that only logs a warning on ImportError. When dbf is missing, the import
silently no-ops and later calls to Table(...) fail with NameError — which
is exactly how TMGimporter/tests/test_integration.py's setUpClass was
crashing in addon-unit runs (reported as _ErrorHolder in the JUnit
output).

Add dbf>=0.99.0 to both the local Dockerfile.ubuntu and the CI
requirements-test.txt so the dependency is present in every environment
where addon tests run. Local TMGimporter run now reports 175/175 OK
(was 157 pass + 1 setUpClass error).
Each addon declares its Python deps via requires_mod=[...] in its
.gpr.py, and Gramps' Addon Manager pip-installs exactly that list when
a user clicks Install (gramps/gui/plug/_windows.py __on_install_clicked
→ requirements.install → gen/utils/requirements.py). Mirror that
behaviour in the testbed so the test environment matches what an
end-user gets, and so new addon deps are picked up automatically
without a parallel list to maintain.

- scripts/ubuntu/run-addon-unit.sh: scan
  /workspace/addons-source/*/*.gpr.py for requires_mod declarations,
  union, pip-install each package individually (so a single build
  failure — pygraphviz without graphviz-dev, psycopg2 without
  libpq-dev — does not abort the batch).
- .github/workflows/addon-unit-tests.yml: same derivation step,
  running against the PR/fork checkout.
- docker/Dockerfile.ubuntu + requirements-test.txt: drop the
  hand-rolled `dbf` entry; it's now covered by the auto-derive, and
  keeping it would create a parallel source of truth that drifts.

Verified locally: union of 9 deps discovered across 8 addons
(boto3, dbf, life_line_chart, litellm, networkx, psycopg, psycopg2,
pygraphviz, svgwrite). 7 install cleanly; psycopg2 and pygraphviz fail
on missing system headers (known; affected addons' tests fail in
isolation). TMGimporter: 175/175 OK purely via auto-derived dbf.
@eduralph
eduralph merged commit bf1a721 into main Apr 20, 2026
3 of 7 checks passed
@eduralph
eduralph deleted the ci/addon-unit-dotted-path branch April 20, 2026 19:35
eduralph added a commit that referenced this pull request May 12, 2026
- Remove .claude/scheduled_tasks.lock from version control. The file
  is a runtime lock created by the schedule skill and shouldn't have
  been committed in #3 (bf1a721).
- Add commonly used read-only Bash patterns to .claude/settings.json
  allow list (python3:*, python:*, cd *, PYTHONPYCACHEPREFIX=*:*,
  PYTHONPATH=*:*, pip show:*, pip list:*) to cut down on permission
  prompts during routine development.
- Gitignore fetch_comments.py — a scratch helper used during one-off
  PR-feedback sweeps that occasionally lands in the workspace root.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant